package com.chenju.invokechainservice.dao;

import com.chenju.invokechainservice.domain.TInterfaceNode;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;

import java.util.List;

public interface TInterfaceNodeRepository extends Neo4jRepository<TInterfaceNode, Long> {
    TInterfaceNode findByName(String name);

    @Query("MATCH (m:TApplicationNode)-[]->(n:TInterfaceNode) WHERE m.name=$applicationName AND n.name=$name RETURN n")
    TInterfaceNode findByApplicationNameAndName(String applicationName, String name);

    @Query("MATCH (m:TMethodNode)-[*]->(n:TInterfaceNode) WHERE m.name=$name RETURN n.name")
    List<String> findAllImpactInterfaceNodeByMethodName(String name);
}
